package com.astronomia.wheels.pojo;

import lombok.Data;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;

/**
 * 人员对象
 **/

@Data
public class Person implements Comparable<Person> {

    private int age;

    private String name;

    private String phone;

    private Optional<String> email;

    private List<Person> personList;

    private LocalDateTime date;

    public Person() {
    }

    public Person(int age, String name, String phone, List<Person> personList) {
        this.age = age;
        this.name = name;
        this.phone = phone;
    }

    public Person(int age, String name, String phone, Optional<String> email) {
        this.age = age;
        this.name = name;
        this.phone = phone;
        this.email = email;
    }

    public Person(int age, String name, LocalDateTime date) {
        this.age = age;
        this.name = name;
        this.date = date;
    }

    public static List<Person> getList() {
        Person person1 = new Person(1, "c", "1", new ArrayList<>());
        Person person2 = new Person(1, "c", "1", new ArrayList<>());
        Person person3 = new Person(3, "方", "3", new ArrayList<>());
        Person person4 = new Person(4, "哈哈", "4", new ArrayList<>());
        Person person5 = new Person(5, "安", "5", new ArrayList<>());
        Person person6 = new Person(6, "整", "6", new ArrayList<>());
        Person person7 = new Person(6, "类", "7", new ArrayList<>());
        return Arrays.asList(person1, person4, person6, person3, person2, person5, person7);
    }

    public static List<Person> getList2() {
        Person person1 = new Person(1, "男", null);
        Person person2 = new Person(2, "男", null);
        Person person3 = new Person(3, "男", null);
        Person person4 = new Person(4, "安", null);
        Person person5 = new Person(5, "安", null);
        Person person6 = new Person(6, "类", null);
        Person person7 = new Person(6, "类", null);
        return Arrays.asList(person1, person4, person6, person3, person2, person5, person7);
    }

    public static List<Person> getList3() {
        Person person1 = new Person(1, "男now", LocalDateTime.now());
        Person person2 = new Person(2, "男1", LocalDateTime.now().plusDays(1));
        Person person3 = new Person(3, "男-1", LocalDateTime.now().plusDays(-1));
        Person person4 = new Person(1, "男-1", LocalDateTime.now().plusDays(-1));
        Person person5 = new Person(2, "男now", LocalDateTime.now());
        Person person6 = new Person(3, "男1", LocalDateTime.now().plusDays(1));
        return Arrays.asList(person1, person4, person6, person3, person2, person5);
    }

    public static List<Person> getList4() {
        Person person1 = new Person(1, null, LocalDateTime.now());
        Person person2 = new Person(2, "男1", LocalDateTime.now().plusDays(1));
        Person person3 = new Person(3, "男-1", LocalDateTime.now().plusDays(-1));
        Person person4 = new Person(1, "男-1", LocalDateTime.now().plusDays(-1));
        Person person5 = new Person(2, "男now", LocalDateTime.now());
        Person person6 = new Person(3, "男1", LocalDateTime.now().plusDays(1));
        return Arrays.asList(person1, person4, person6, person3, person2, person5);
    }

    @Override
    public int compareTo(Person o) {
        return 0;
    }

    @Override
    public String toString() {
        return "Person{" +
                "age=" + age +
                ", name='" + name + '\'' +
                ", phone='" + phone + '\'' +
                ", email=" + email +
                ", personList=" + personList +
                '}';
    }
}
